import 'package:flutter/material.dart';
import 'package:get/get.dart';
///我的推广控制器
class MyPromotionsController extends GetxController with SingleGetTickerProviderMixin{
  
  late TabController tabController;
  late TabController orderTabController;

  final fileUrl = "https://img2.baidu.com/it/u=4005115713,4032301397&fm=253&fmt=auto&app=138&f=GIF?w=200&h=200";


  @override
  void onInit() {
    
    //--------
    tabController = TabController(length: 2, vsync: this);
    tabController.addListener(() { 
      if(tabController.index.toDouble()==tabController.animation?.value){
        print("切换了状态${tabController.index}");
      }
  });
    //--------------

    //--------
    orderTabController = TabController(length: 4, vsync: this);
    orderTabController.addListener(() { 
      if (orderTabController.indexIsChanging) {
        // 当tab切换时执行的操作
        print("切换了状态，当前为态为 index: ${orderTabController.index}");
      }
    });
    //--------------

    super.onInit();
  }

  @override
  void onClose() {
    tabController.dispose();
    orderTabController.dispose();
    super.onClose();
  }

}
